/**
 * 
 */
package org.codesketch.controller.dao.impl;

import java.util.List;

import org.codesketch.controller.dao.TaskRepository;
import org.codesketch.controller.domain.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Repository;

/**
 * {@link TaskRepository} interface implementation.
 * @author Quirno Brizi
 *
 */
@Repository
public class TaskRepositoryImpl implements TaskRepository {

	@Autowired
	private transient MongoTemplate template;
	
	@Override
	public void insert(Task task) {
		template.insert(task);
	}

	@Override
	public void save(Task task) {
		template.save(task);
	}
	
	@Override
	public Task find(Long id) {
		return template.findById(id, Task.class);
	}

	@Override
	public List<Task> findAll() {
		return template.findAll(Task.class);
	}

}
